import asyncio
import csv
import math
from typing import Tuple
import repast4py.space as space
from repast4py.core import Agent
from repast4py.space import DiscretePoint as dpt
from repast4py.space import ContinuousSpace
from repast4py.space import ContinuousPoint as cpt
from repast4py import context as ctx
from repast4py import schedule, logging
from mpi4py import MPI

from random import randint, randrange
import pandas as pd
import numpy as np
import json
import copy
import random
import time
import os
import sys
import networkx as nx
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
from MeiTuan.outlier_detection import anormal_region_detection
from MeiTuan.dispatch import two_stage_fast_heuristic
from MeiTuan.cal_utility import calUtility
from agentDesign.L1.read_map import AStarPlanner, ReadMap
from initmodel.initriders import init_riders
from cognitive.rider_plan import plan_time, plan_position, check_money, trick_to_time
from MeiTuan.generateOrders import fitting_dist, orders_list

from cognitive.rider_transfer_llm import get_new_work_location
from LLM.accept_order_llm import accept_order
from LLM.choose_region_llm import choose_region_llm
from env import (door_list_random, get_which_region, WALK_NUM, ONE_DAY, ONE_HOUR, ONE_MIN, Region_info, REGION_LINE,
                 REGION_WORK, mean_point, points_dis)
from user import User
from agentDesign.agent import Individual


#  运行模型时候新建棋手，需要选择：学习方式，活动时间


class Npc(Individual):
    TYPE = 3

    def __init__(self,
                 r_id: int,
                 rank: int,
                 model,

                 home: tuple,
                 ):
        super().__init__(id=r_id, rank=rank, t=Npc.TYPE, home=home, feature=[])
        # 初始化骑手的属性，例如位置、速度等
        self.model = model  # 当前模型

    def step(self):
        self.random_walk_regular()
